package lb.io.utils;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.core.config.ConfigurationSource;
import org.apache.logging.log4j.core.config.Configurator;

import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;

public class Klog {
    static {
        File log4j2 = new File(Strings.LBRoot() + "log4j2.xml");
        InputStream log4j2Stream = null;
        try {
            log4j2Stream = new FileInputStream(log4j2);
            ConfigurationSource source = new ConfigurationSource(log4j2Stream, log4j2);
            Configurator.initialize(null, source);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public static Logger getLogger(Class<?> classz) {
        return LogManager.getLogger(classz);
    }
}
